using System.Text;
using System.Web.Services.Protocols;

namespace Thinktecture.Tools.Web.Services.Extensions
{
	public class SoapHttpClientProtocolExtended : SoapHttpClientProtocol
	{
		private byte[] m_SoapRequestMsg;
		private byte[] m_SoapResponseMsg;

		/// <summary>
		/// Creates a new <see cref="SoapHttpClientProtocolExtended"/> instance.
		/// </summary>
		public SoapHttpClientProtocolExtended()
		{	
		}

		/// <summary>
		/// Sets the SOAP request internal.
		/// </summary>
		/// <value></value>
		internal byte[] SoapRequestInternal
		{
			set
			{
				m_SoapRequestMsg = value;
			}
		}

		/// <summary>
		/// Sets the SOAP response internal.
		/// </summary>
		/// <value></value>
		internal byte[] SoapResponseInternal
		{
			set
			{
				m_SoapResponseMsg = value;
			}
		}

		/// <summary>
		/// Gets the SOAP request.
		/// </summary>
		/// <value></value>
		public byte[] SoapRequest
		{
			get
			{
				return m_SoapRequestMsg;
			}
		}
		
		/// <summary>
		/// Gets the SOAP response.
		/// </summary>
		/// <value></value>
		public byte[] SoapResponse
		{
			get
			{
				return m_SoapResponseMsg;
			}
		}

		/// <summary>
		/// Gets the SOAP request string.
		/// </summary>
		/// <value></value>
		public string SoapRequestString
		{
			get
			{
				byte[] result = m_SoapRequestMsg;
				UTF8Encoding enc = new UTF8Encoding();
				
				return enc.GetString(result);
			}
		}
		
		/// <summary>
		/// Gets the SOAP response string.
		/// </summary>
		/// <value></value>
		public string SoapResponseString
		{
			get
			{
				byte[] result = m_SoapResponseMsg;
				UTF8Encoding enc = new UTF8Encoding();
				
				return enc.GetString(result);
			}
		}
	}
}
